import _Fetch from '@/server/Fetch'
import { API_POST_EVALUATION } from '@/api/evaluation/get_evaluation_info'
import { API_POST_COURSE_INFO, API_POST_OFF_LINE_COURSE_INFO } from '@/api/college/get_course_detail_info'
import { API_POST_PAY } from '@/api/order/api'
import { API_POST_ADD_ORDER } from '@/api/consulting/add_consulting_order'
/**
 * 获取 首页卡片数据
 */
export async function get_data_api(id, type) {
  if (type === 1) {
    // 请求 测评
    return await _Fetch(API_POST_EVALUATION, {
      questionNameId: id,
    })
  } else if (type === 2) {
    // 课程
    return await _Fetch(API_POST_COURSE_INFO, {
      courseNameId: id,
    })
  } else {
    // 线下课程
    return await _Fetch(API_POST_OFF_LINE_COURSE_INFO, {
      id: id,
    })
  }
}

//下单
export async function addOrder_api(params) {
  return await _Fetch(API_POST_ADD_ORDER, {
    ...params,
  })
}
//支付
export async function pay_api(orderId: any) {
  return await _Fetch(API_POST_PAY, {
    sn: orderId,
  })
}
